home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Utilities / MPW Extras / Scripts / OpenStatus < prev    next >
Encoding:
Text File  |  1991-07-29  |  735 b   |  15 lines  |  [TEXT/MPS ]

  1. # OpenStatus - script to determine the open/closed status of a file
  2.  
  3. Set RetVal 0                                                                                            # default return value is closed (returned in case of error)
  4. Set NFile {#}                                                                                            # Get number of command line arguments
  5. If ({NFile} == 1)
  6.     Set Attributes "`Files -n -x a "{1}" ≥ Dev:Null`"
  7.     Set Attributes "`Echo "{Attributes}" | StreamEdit -d -e '/(≈ )*([¬ ]*)®1/ Print ®1' ≥ Dev:Null`"    # strip out the file's attributes
  8.     Set OpenStatus "`Echo "{Attributes}" | StreamEdit -d -e '/(≈p)*([¬i]*)®1/ Print ®1' ≥ Dev:Null`"    # strip out the file's open status
  9.     If ({OpenStatus} == "O")
  10.         Set RetVal 1                                                                                    # indicate an open file
  11.     End  # If {OpenStatus}
  12. End  # If {NFile}
  13. Exit {RetVal}
  14.  
  15. # end of OpenStatus